import axios from 'axios'

const studentApi = {
  // 获取学生列表
  getList(page, size) {
    return axios.get(`/student/list/${page}/${size}`)
  },
  
  // 搜索学生
  search(params) {
    return axios.get('/student/search', { params })
  },
  
  // 删除学生
  deleteById(id) {
    return axios.delete(`/student/deleteById/${id}`)
  },
  saveStudent(data) {
    return axios.post('/student/save', data)
  },
  
  // 获取可用宿舍列表
  getAvailableDormitories() {
    return axios.get('/dormitory/availableList')
  },
  updateStudent(data) {
    return axios.put('/student/update', data)
  },
  
  // 获取可用宿舍列表
  getAvailableDormitories() {
    return axios.get('/dormitory/availableList')
  },
  
  // 根据ID查询学生
  getStudentById(id) {
    return axios.get(`/student/findById/${id}`)
  },
}

export default studentApi